Multi-cohort support with per-member initial balance#358
Merged
briansmiley merged 31 commits intomainfrom Apr 13, 2026
Merged
Conversation
- Add global SQLite DB for users, cohorts, membership, and config - Per-cohort WebSocket routes at /api/ws/:cohort_name - REST endpoints for cohort listing and admin management - Restructure frontend routes under /[cohort_name]/ - Cohort selection page with auto-redirect for single cohort - Admin page for cohort/member/config management - Public auction access with auction-only mode - Cohort-scoped localStorage keys - Legacy DB auto-migration support
Resolve conflicts: - websocket_sudo.rs: drop removed market positions test - api.svelte.ts: keep both auctionOnly and sudoEnabled - +layout.svelte: keep stripped auth-only root layout - market/+page.svelte: keep getCurrentCohort, drop scenariosApi - Move performance page under [cohort_name]/ - Update scroll handler with hysteresis from main
… multi-cohort support - Add initial_balance column to cohort_member table with migration - Look up configured initial balance on account creation, falling back to legacy defaults (admin=100M, non-admin=0) when NULL - Split member management into dedicated /admin/cohorts/[name] detail page - Simplify admin page cohort list with navigation links - Add default_cohort_id config option - Update python client for multi-cohort WebSocket endpoints
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
- Add create_if_missing param to DB::init_with_path - Clean up global DB row if cohort DB init fails (prevents UNIQUE constraint on retry) - Add existing_db checkbox to admin UI (fails if DB file doesn't exist) - Add GlobalDB::delete_cohort for rollback - Add apiBase.ts, CORS and cross-origin fixes
sqlite:///data/foo.sqlite should resolve to /data/, not data/
- Backend endpoint lists .sqlite files not yet used by cohorts - Frontend shows them as buttons that fill the slug and check "use existing DB"
- CohortState.is_read_only is now AtomicBool, loaded per-message - Admin toggle updates the atomic, no restart needed
- New migration adds email column to global_user - ensure_global_user stores email from Kinde auth - Cohort members query falls back to global_user email - Admin "All Users" list shows emails and searches by email
- Display name editing for all users on accounts page (cross-cohort) - Admin user management: edit names, toggle admin, delete users with confirm modals - Account color coding: color field in proto/DB, color picker for admins, colored dots in act-as dropdown, colored header when acting as colored account - Switch cohort button only shown with multiple cohorts, moved to sidebar footer - Editable initial balance for non-instantiated cohort members - Fix 404 on admin page reload (disable prerender/SSR for admin routes) - Hide read-only toggle from main admin page (keep on cohort detail page)
Trivial resolutions: - .gitignore: combine both additions - schema protos: use `optional string color` from main - .sqlx caches: keep both renamed versions - airtable_users.rs: accept multi-cohort's deletion - schema-js: take main's generated files Backend resolutions: - convert.rs: take main's expanded Account formatting - db.rs: keep multi-cohort's global_user_id checks, main's color validation (Option<String> with trim/validate/lowercase) - handle_socket.rs: keep multi-cohort's admin_id owner logic, use Option color type - websocket_universes test: use color: None Frontend resolutions: - +page.svelte: keep multi-cohort's cohort selector (replaces main's /auction redirect) - +layout.svelte: keep multi-cohort's simplified root layout, port main's normalizeAccountColor to cohort layout - auction page: add main's sidebar auto-collapse - appSideBar: merge cohort URLs with main's MarketName component and Performance page link - selectMarket: cohort URLs + MarketName component - actAs: keep both accountColor and disambiguatedAccountNames - api.svelte.ts: keep both checkAdminAccess and disambiguatedAccountNames Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Regenerate schema-js protobuf bindings (adds auctionOnly to IAuthenticated) - Remove duplicate color properties in createAccount.svelte - Fix migration timestamp conflict (rename arbor_pixie_initial_balance) - Remove duplicate add_account_color migration - Port normalizeAccountColor and accountHeaderStyle to cohort layout - Remove unused mut on is_member in handle_socket.rs Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Remove needless raw string hashes in global_db.rs and db.rs - Use format string interpolation and is_some_and per clippy - Add backticks to doc comments referencing identifiers - Fix prettier formatting in createAccount.svelte - Remove unused accountColor function in actAs.svelte Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The variable is reassigned inside a #[cfg(feature = "dev-mode")] block, so cargo check without the feature flag incorrectly reports it as unused mut, but it's required when dev-mode is enabled. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Update websocket_visibility tests for multi-cohort AppState (use global_db + cohort pattern instead of app_state.db) - Fix color insert: use unwrap_or_default() to insert empty string instead of NULL for NOT NULL column Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
Author
- Regenerate .sqlx/ offline query cache for CI (SQLX_OFFLINE=true) - Add #[allow(unused_mut)] on is_member since mut is only needed under dev-mode feature gate Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add # Errors doc sections to get_legacy_kinde_users, get_balance_by_global_user_id, set_global_user_id - Allow clippy::too_many_arguments on handle_client_message Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Remove autofocus from inline edit inputs (a11y_autofocus) - Add svelte-ignore comments for modal backdrop div interactions (a11y_no_noninteractive_element_interactions, a11y_click_events_have_key_events) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Allow option_option on UpdateConfigRequest (intentional PATCH semantics: distinguishes "not provided" from "set to null") - Use let...else instead of match for read_dir fallback Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…g panics doc - Remove unused CohortInfo import in test_utils.rs - Replace redundant closures with ToString::to_string in auth.rs - Add # Panics doc section to spawn_test_server Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Auto-fix: inline format args across all test files and db.rs - Auto-fix: doc backticks in test comments - Allow similar_names, too_many_lines, used_underscore_binding in test files (splitting tests or renaming market_a/market_b hurts readability more than it helps) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Previously, creating a cohort without 'Use existing database' checked would silently adopt an existing .sqlite file at the same path. Now returns 400 with a message pointing to the checkbox.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Summary
/[cohort_name]/market, etc.), each cohort has its own SQLite database, and a global database tracks users/membership across cohorts/adminto a dedicated/admin/cohorts/[name]page with user combobox, email batch add, and initial balance inputsmetagamepackage updated for multi-cohort WebSocket endpoints (/api/ws/{cohort_name}) and cohort discovery via REST APIdefault_cohort_idsetting for python client/scenarios server targetingfixes: ARB-357 ARB-382 ARB 415
Test plan
dev.sh, login as admin, verify/adminshows cohort list with chevron links